<title>文章编辑</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>问答管理</cite></a>
    <a><cite>文章编辑</cite></a>
  </div>
</div>

<div class="layui-fluid">
  <div class="layui-card">
  	<div class="layui-card-header"><a lay-href="wendasns/article/index" style="color: #990000;margin-right: 10px;">&lt;&lt; 返回上一级</a></div>
  	<div class="layui-card-body">
  	
<form class="layui-form" action="{:url('wendasns/article/edit')}" method="post">
        <input type="hidden" name="id" value="{$data.id}">

  <div class="layui-form-item">
    <label class="layui-form-label">作者</label>
    <div class="layui-input-inline">
        <input type="text" value="{$data.users.username}" class="layui-input layui-disabled" disabled>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-block">
        <input type="text" name="title" value="{$data.title}" class="layui-input">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">内容</label>
    <div class="layui-input-block">
        <textarea id="J_textarea" style="display: none;" name="content" data-id="">{$data.content}</textarea>
    </div>
  </div>

  
  <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-inline">
              <select name="category_id" >
                {volist name="category" id="item"}
                <option value="{$item.id}" {if $data.category_id eq $item.id}selected{/if}>{$item.name}</option>
                {/volist}
              </select>
            </div>
          </div>
        </div>
        
  <div class="layui-form-item">
    <label class="layui-form-label">标签</label>
    <div class="layui-input-inline">
        <input type="text" name="tags" value="{$data.tags}" class="layui-input">
    </div>
    <div class="layui-form-mid layui-word-aux">多个标签用户空格或英文,号隔开</div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">点赞数</label>
    <div class="layui-input-inline">
        <input type="text" name="praise" value="{$data.praise}" lay-verify="number" class="layui-input">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">浏览量</label>
    <div class="layui-input-inline">
        <input type="text" name="visits" value="{$data.visits}" lay-verify="number" class="layui-input">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">收藏量</label>
    <div class="layui-input-inline">
        <input type="text" name="collect" value="{$data.collect}" lay-verify="number" class="layui-input">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">举报数</label>
    <div class="layui-input-inline">
        <input type="text" value="{$data.report}" class="layui-input layui-disabled" disabled>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">评论数</label>
    <div class="layui-input-inline">
        <input type="text" value="{$data.comment}" class="layui-input layui-disabled" disabled>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">发布IP</label>
    <div class="layui-input-inline">
        <input type="text" name="ip" value="{$data.ip}" lay-verify="ip" class="layui-input">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">发布来源</label>
    <div class="layui-input-inline">
          <select name="client">
          	<option value="">无</option>
            <option value="Android" {if $data.status eq 'Android'}selected="selected"{/if}>Android</option>
            <option value="iPhone" {if $data.status eq 'iPhone'}selected="selected"{/if}>iPhone</option>
            <option value="Mac" {if $data.status eq 'Mac'}selected="selected"{/if}>Mac</option>
            <option value="iPad" {if $data.status eq 'iPad'}selected="selected"{/if}>iPad</option>
            <option value="Windows" {if $data.status eq 'Windows'}selected="selected"{/if}>Windows</option>
          </select>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">发布时间</label>
    <div class="layui-input-inline">
          <input id="J_create_time" type="text" name="create_time" value="{$data.create_time}" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">置顶</label>
    <div class="layui-input-inline">
        <input type="radio" name="top" value="1" title="是" {if $data.top eq 1}checked{/if}>
        <input type="radio" name="top" value="0" title="否" {if $data.top eq 0}checked{/if}>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">推荐</label>
    <div class="layui-input-inline">
        <input type="radio" name="recommend" value="1" title="是" {if $data.recommend eq 1}checked{/if}>
        <input type="radio" name="recommend" value="0" title="否" {if $data.recommend eq 0}checked{/if}>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">禁止评论</label>
    <div class="layui-input-inline">
        <input type="radio" name="close" value="1" title="是" {if $data.close eq 1}checked{/if}>
        <input type="radio" name="close" value="0" title="否" {if $data.close eq 0}checked{/if}>
    </div>
    <div class="layui-form-mid layui-word-aux">禁止网友评论文章</div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">删除文章</label>
    <div class="layui-input-inline">
        <input type="radio" name="remove" value="1" title="是" {if $data.remove eq 1}checked{/if}>
        <input type="radio" name="remove" value="0" title="否" {if $data.remove eq 0}checked{/if}>
    </div>
  </div>

  <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
            	<input type="radio" name="status" value="normal" title="正常" {if $data.status eq 'normal'}checked{/if}>
            	<input type="radio" name="status" value="check" title="待审核" {if $data.status eq 'check'}checked{/if}>
            </div>
          </div>
        </div>
        
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button lay-submit lay-filter="J_ajax_submit_btn" class="layui-btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
    </div>
  </div>
</form>

</div>
</div>
</div>
<script src="/ueditor/ueditor.init.js"></script>
<script>
;!function(){
  var $ = layui.$
  ,layedit = layui.layedit
  ,laydate = layui.laydate
  ,form = layui.form;
  
  form.render();
  
	layedit.set({
	  uploadImage: {
	    url: '{:url('wendasns/article/upload')}'
	  },
	  height: 400
	});

	var index = layedit.build('J_textarea');
	layui.$('#J_textarea').attr('data-id',index);
	
	laydate.render({
    elem: '#J_create_time'
    ,type: 'datetime'
  });
}();
</script>